package com.atguigu.spring.aspectJ.annotation;

import java.util.Arrays;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * 验证切面
 *
 */
@Component
@Aspect
@Order(1)  // 设置切面的优先级   2147483647     0x7fffffff   01111111 11111111 11111111 11111111
public class ValidationAspect {

	//@Before("execution(* com.atguigu.spring.aspectJ.annotation.*.*(..))")
	@Before("LoggingAspect.declarePointCut()")
	public void beforeMethod(JoinPoint joinPoint) {
		
		String methodName = joinPoint.getSignature().getName();
		
		Object [] args = joinPoint.getArgs();
		
		System.out.println("ValidationAspect==> The method "+methodName + "begin with " +Arrays.asList(args) );
	}
}
